/*
 * @Author: your name
 * @Date: 2021-09-01 20:04:56
 * @LastEditTime: 2022-03-18 21:54:10
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \phone\src\input_number.cpp
 */
#include "input_number.h"
InputNumber::InputNumber(std::unique_ptr<Widget> &page, NumToString &num, Widget *editView) : InputItem(page, num.numString, editView)/*, primaryWidget(page)*/, number(num)
{
    SetMaxLength(MAX_DIGITS);
}
void InputNumber::SetEditString(Widget *widget, std::string value, unsigned int index)
{
    number.number = std::stoi(value);
    InputItem::SetEditString(widget, value, index);
}
void InputNumber::InputMethodSelection(InputMethodsType &method, InputMethodsType &lastMethod)
{
    lastMethod = InputMethodsType::FUNCTION_END;
    method = InputMethodsType::INPUT_METHOD_NUM;
}
std::string InputNumber::GetString()
{
    number.numString = std::to_string(number.number);
    return number.numString;
}